package com.chare.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chare.mapper.AdminRoleMapper;
import com.chare.pojo.AdminRole;
import com.chare.pojo.RespBean;
import com.chare.service.IAdminRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author shi
 * @since 2022-06-17
 */
@Service
public class AdminRoleServiceImpl extends ServiceImpl<AdminRoleMapper, AdminRole> implements IAdminRoleService {
@Autowired
private AdminRoleMapper adminRoleMapper;
    @Override
    public RespBean updateRole(Integer adminId, Integer[] rids) {
        adminRoleMapper.delete(new QueryWrapper<AdminRole>().eq("adminId",adminId));
       Integer reseut=adminRoleMapper.updateRole(adminId,rids);
       if(reseut==rids.length)
       {
           return RespBean.success("更新成功");
       }
        return RespBean.success("更新失败");
    }
}
